# -*- coding: utf-8 -*- 
#
# Description:
#
#  Definiton
#
#
#
# Changes:
#
# 2012-01-10
# Initial Commit
#
#
# Copyright 2010-2012, WyDev Team.
# Author: Polo35 (polo35580@hotmail.fr)
#
# Licenced under Academic Free License version 3.0
# Review WyGui README & LICENSE files for further details.

nname: 0
n 0(None)[TextBlock.__init__(self, *args, **kwargs)
global_timer.register_callback('clock', self._update)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb774adac>}
nname: 175
n 175(None)[]:
	i: 94(JA), 170(), 174()
	o: 

nname: 174
n 174(None)[]:
	i: 0(f)
	o: 175()

nname: 170
n 170(None)[]:
	i: 6(f)
	o: 175()

nname: 94
n 94(None)[Clock.time_format = kwargs.get('time_format', Clock.time_format)
Clock.global_format = kwargs.get('global_format', Clock.global_format)
Clock.date_format = kwargs.get('date_format', Clock.date_format)
]:
	i: 6(t)
	o: 175(JA)

nname: 6
n 6(sender == Clock.shared_name)[self.time_format = kwargs.get('time_format', self.time_format)
self.global_format = kwargs.get('global_format', self.global_format)
self.date_format = kwargs.get('date_format', self.date_format)
]:
	i: 0(t)
	o: 94(t), 170(f)

nname: 0
n 0(kwargs)[]:
	i: 
	o: 6(t), 174(f)

nname: 0
n 0(None)[if kwargs:
	self.time_format = kwargs.get('time_format', self.time_format)
	self.global_format = kwargs.get('global_format', self.global_format)
	self.date_format = kwargs.get('date_format', self.date_format)
	if sender == Clock.shared_name:
		Clock.time_format = kwargs.get('time_format', Clock.time_format)
		Clock.global_format = kwargs.get('global_format', Clock.global_format)
		Clock.date_format = kwargs.get('date_format', Clock.date_format)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb775168c>}
nname: 0
n 0(None)[self.time_format = time_format
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb774aacc>}
nname: 0
n 0(None)[self.date_format = date_format
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb774ab0c>}
nname: 0
n 0(None)[self.global_format = global_format
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb774aaac>}
nname: 0
n 0(None)[format = self.global_format.replace('%time', self.time_format).replace('%date', self.date_format)
self.set_text(strftime(format, localtime(timestamp)))
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb774aecc>}
nname: 0
n 0(None)[global_timer.unregister_callback('clock', self._update)
TextBlock.clear(self)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb774aeac>}
nname: 6
n 6(None)[__doc__ = "A simple clock widget.\n    It registers to a global timer and set time every time the tick goes off.\n\n    The clock's format can be customized through the format_string attribute,\n    which is used as an argument to the time.strftime() function (see its\n    docs at http://docs.python.org/lib/module-time.html).\n    "
shared_name = 'clock'
global_format = '%time'
time_format = get_time_format()
date_format = get_date_format()
def __init__(self, *args, **args):
	TextBlock.__init__(self, *args, **kwargs)
	global_timer.register_callback('clock', self._update)

def update(self, signal, sender, *args, **args):
	if kwargs:
		self.time_format = kwargs.get('time_format', self.time_format)
		self.global_format = kwargs.get('global_format', self.global_format)
		self.date_format = kwargs.get('date_format', self.date_format)
		if sender == Clock.shared_name:
			Clock.time_format = kwargs.get('time_format', Clock.time_format)
			Clock.global_format = kwargs.get('global_format', Clock.global_format)
			Clock.date_format = kwargs.get('date_format', Clock.date_format)

initialize = update
def set_time_format(self, time_format):
	self.time_format = time_format

def set_date_format(self, date_format):
	self.date_format = date_format

def set_global_format(self, global_format):
	self.global_format = global_format

def _update(self, timestamp):
	format = self.global_format.replace('%time', self.time_format).replace('%date', self.date_format)
	self.set_text(strftime(format, localtime(timestamp)))

def clear(self):
	global_timer.unregister_callback('clock', self._update)
	TextBlock.clear(self)

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb774a7ac>}
nname: 0
n 0(None)[from __future__ import absolute_import
from time import time, strftime, localtime
from .textblock import TextBlock
from pygui.facilities.l10n import get_date_format, get_time_format
from peewee.notifier import global_timer
class Clock(TextBlock):
	__doc__ = "A simple clock widget.\n    It registers to a global timer and set time every time the tick goes off.\n\n    The clock's format can be customized through the format_string attribute,\n    which is used as an argument to the time.strftime() function (see its\n    docs at http://docs.python.org/lib/module-time.html).\n    "
	shared_name = 'clock'
	global_format = '%time'
	time_format = get_time_format()
	date_format = get_date_format()
	def __init__(self, *args, **args):
		TextBlock.__init__(self, *args, **kwargs)
		global_timer.register_callback('clock', self._update)

	def update(self, signal, sender, *args, **args):
		if kwargs:
			self.time_format = kwargs.get('time_format', self.time_format)
			self.global_format = kwargs.get('global_format', self.global_format)
			self.date_format = kwargs.get('date_format', self.date_format)
			if sender == Clock.shared_name:
				Clock.time_format = kwargs.get('time_format', Clock.time_format)
				Clock.global_format = kwargs.get('global_format', Clock.global_format)
				Clock.date_format = kwargs.get('date_format', Clock.date_format)

	initialize = update
	def set_time_format(self, time_format):
		self.time_format = time_format

	def set_date_format(self, date_format):
		self.date_format = date_format

	def set_global_format(self, global_format):
		self.global_format = global_format

	def _update(self, timestamp):
		format = self.global_format.replace('%time', self.time_format).replace('%date', self.date_format)
		self.set_text(strftime(format, localtime(timestamp)))

	def clear(self):
		global_timer.unregister_callback('clock', self._update)
		TextBlock.clear(self)



]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb77439cc>}
from __future__ import absolute_import
from time import time, strftime, localtime
from .textblock import TextBlock
from pygui.facilities.l10n import get_date_format, get_time_format
from peewee.notifier import global_timer
class Clock(TextBlock):
	__doc__ = "A simple clock widget.\n    It registers to a global timer and set time every time the tick goes off.\n\n    The clock's format can be customized through the format_string attribute,\n    which is used as an argument to the time.strftime() function (see its\n    docs at http://docs.python.org/lib/module-time.html).\n    "
	shared_name = 'clock'
	global_format = '%time'
	time_format = get_time_format()
	date_format = get_date_format()
	def __init__(self, *args, **args):
		TextBlock.__init__(self, *args, **kwargs)
		global_timer.register_callback('clock', self._update)

	def update(self, signal, sender, *args, **args):
		if kwargs:
			self.time_format = kwargs.get('time_format', self.time_format)
			self.global_format = kwargs.get('global_format', self.global_format)
			self.date_format = kwargs.get('date_format', self.date_format)
			if sender == Clock.shared_name:
				Clock.time_format = kwargs.get('time_format', Clock.time_format)
				Clock.global_format = kwargs.get('global_format', Clock.global_format)
				Clock.date_format = kwargs.get('date_format', Clock.date_format)

	initialize = update
	def set_time_format(self, time_format):
		self.time_format = time_format

	def set_date_format(self, date_format):
		self.date_format = date_format

	def set_global_format(self, global_format):
		self.global_format = global_format

	def _update(self, timestamp):
		format = self.global_format.replace('%time', self.time_format).replace('%date', self.date_format)
		self.set_text(strftime(format, localtime(timestamp)))

	def clear(self):
		global_timer.unregister_callback('clock', self._update)
		TextBlock.clear(self)



